<template>
  <div class="skill-container">
    <div class="skill" v-for="(item, index) in datas" :key="item.name">
      <span class="title">{{ item.name }}</span>
      <div class="skillbar html">
        <div
          class="filled filled0"
          v-if="item.budgetRatio > 1"
          :style="{ width: 100 - (index + 1) * 3.3 + '%' }"
        >
          <span class="actual-value">{{ item.actualValue }}kWh</span>
        </div>

        <div
          class="filled filled1"
          v-else
          :style="{ width: item.budgetRatio * 100 + '%' }"
        >
          <span class="actual-value">{{ item.actualValue }}kWh</span>
        </div>

        <div
          class="filled filled2"
          :style="{ width: 79 - (index + 1) * 3 + '%' }"
        >
          <span class="budget-value">{{ item.budgetValue }}kWh</span>
        </div>

        <span class="percent"></span>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: ["datas"],
};
</script>
<style lang="less" scoped>
.skill-container {
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
}
.skill {
  width: 100%;
  // background-color: #e3e3e3;
  height: 54px;
  font-size: 16px;
  padding: 2px;
  align-items: center;
  border-radius: 5px;
  // margin: auto;
  display: flex;
}

.skillbar {
  width: 100%;
  padding: 5px;
  margin: 15px 0;
  position: relative;
  display: block;
  // overflow: hidden;
  height: 20px;
  // background-color: #fff;
  border-radius: 5px 0 0 5px;
  border: 2px solid #112c44;
}


.skillbar.html .filled0 {
  background-color: #ee7575;
  z-index: 1;
}

.skillbar.html .filled1 {
  background-color: #09bdd7;
  z-index: 3;
}

.skillbar.html .filled2 {
  background-color: #116cb0;
  z-index: 2;
}
.title {
  background-color: rgba(0, 0, 0, 0.6);
  height: 30px;
  width: 35%;
  text-align: center;
  line-height: 30px;
  border-radius: 5px 0 0 5px;
  font-size: 16px;
  color: #97daf8;
}

.skillbar .percent {
  right: 0;
  color: #fff;
  font-weight: 700;
  position: absolute;
  top: 0;
  z-index: 9;
}

.skillbar .filled {
  z-index: 8;
  position: absolute;
  top: 50%;
  left: 0;
  height: 94%;
  transform: translateY(-50%);
  border-radius: 5px 0 0 5px;
}
.budget-value {
  position: absolute;
  top: -20px;
  color: #116cb0;
  right: 0;
}
.actual-value {
  position: absolute;
  right: -10px;
  top: 20px;
  color: #09bdd7;
}
</style>
